<?php
ob_start();
require_once '../sub/init.php';
if(@!in_array('qun',$navarr))exit('该功能已关闭');
require_once ZEAI.'sub/conn.php';
require_once ZEAI.'m/my_chk_u.php';
require_once ZEAI.'cache/udata.php';$FT=json_decode(FT,true);
require_once ZEAI.'m/div_left_so.php';
$qid=intval($qid);
$row = $db->ROW(__TBL_QUN__,"uid,title","flag>0 AND id=".$qid,"name");
if ($row){
	$title = trimhtml(dataIO($row['title'],'out'));
	$uid   = intval($row['uid']);$qzuid=$uid;
}else{
	alert('亲，当前群不存在~',mHref('qun'));
}
if($submitok=='delulist'){
	if(!ifint($qid) || !ifint($uid2))json_exit(array('flag'=>1,'msg'=>'zeai_error_qid_uid'));
	if ($qzuid==$cook_uid && $qzuid!=$uid2)$db->query("DELETE FROM ".__TBL_QUN_U__." WHERE qid=".$qid." AND uid=".$uid2);
	json_exit(array('flag'=>1,'msg'=>'删除成功'));
}
if (!$db->ROW(__TBL_QUN_U__,"id","qid=".$qid." AND uid=".$cook_uid))zeaialert('{"title":"亲，只有群内成员才可以浏览哦~","btnt":"朕知道了","btnt_back":"看看其他群","btnt_back_url":"qun.php","url":"-1"}');
//alert('亲，只有群内成员才可以浏览哦~','-1');
$jumpurl = HOST.'/m/qun_ulist.php?qid='.$qid;
$switch = json_decode($_ZEAI['switch'],true);
/****SQL主体*****/
$nodatatips="<div class='nodatatips'><i class='ico'>&#xe8ab;</i>暂时木有记录</div>";
function rows_ulist($rows,$p) {
	global $_ZEAI,$switch,$cook_grade,$qzuid,$qid,$cook_uid;
	$uid      = $rows['uid'];
	$uflag    = $rows['uflag'];
	$sex      = $rows['sex'];
	$grade    = $rows['grade'];
	$photo_s  = $rows['photo_s'];
	$photo_f  = $rows['photo_f'];
	$areatitle= $rows['areatitle'];
	$birthday = $rows['birthday'];
	$heigh    = $rows['heigh'];
	$edu      = $rows['edu'];
	$gzflag   = $rows['gzflag'];
	$flag     = $rows['flag'];
	$job     = $rows['job'];
	$photo_ifshow = $rows['photo_ifshow'];
	$aARR = explode(' ',$areatitle);
	$areatitle = (empty($aARR[2]))?$aARR[1]:$aARR[2];
	$unifo1='';
	$unifo1 .= (getage($birthday)<=0)?'':'<b>'.getage($birthday).'岁</b>';
	$unifo1 .= (empty($areatitle))?'':'<b class="ico">&#xe624; '.$areatitle.'</b>';
	$unifo='';
	$unifo .= (empty($heigh))?'':'<b>・</b>'.udata('heigh',$heigh);
	$unifo .= (empty($edu))?'':'<b>・</b>'.udata('edu',$edu);
	$unifo .= (empty($job))?'':'<b>・</b>'.udata('job',$job);
	$unifo=ltrim($unifo,'<b>・</b>');
	$unickname= trimhtml(dataIO($rows['nickname'],'out'));
	$photo_s_url=photo_s_out('{"smb":"m","sex":"'.$sex.'","photo_s":"'.$photo_s.'","photo_f":"'.$photo_f.'","photo_ifshow":"'.$photo_ifshow.'","uflag":"'.$uflag.'","outkind":"url"}');
	$href2 = 'chat.php?uid='.$uid;
	$qzstr = ($qzuid==$uid)?'<span class="zeaibg">群主</span>':'';
	$Del=($qzuid==$cook_uid && $qzuid!=$uid)?'<font class="ico" onclick="delulist(this,'.$qid.','.$uid.');">&#xe62c;</font>':'';
	$O  = '<dl>';
	$O .= '<dt><a href="'.mHref('u',$uid).'"><img src="'.$photo_s_url.'">'.$qzstr.'</a>'.$Del.'</dt>';
	$O .= '<dd><h4>'.uicon($sex.$grade).'<span>'.$unickname.'</span></h4><h5>'.$unifo1.'</h5><h6>'.$unifo.'</h6></dd>';
	if(@in_array('chat',$navarr))$O .= '<a href="'.$href2.'" class="enter"><i class="ico">&#xe629;</i> 聊天</a>';
	$O .= '</dl>';
	return $O;
}
$_ZEAI['pagesize'] = 7;
$ZEAI_SQL="";
//div_so
switch ($t) {
	case 'ext':
		$keyword = trimhtml(dataIO($keyword,'out'));
		if (!empty($keyword)){
			if (ifint($keyword)){
				$ZEAI_SQL .= " AND U.id='$keyword' ";
			}else{
				$ZEAI_SQL .= " AND U.nickname LIKE '%".$keyword."%' ";
			}
		}else{
			$sex=trimhtml(dataIO($sex,'out'));if(!empty($sex))$ZEAI_SQL .= doinsql('U.sex',$sex);
			$photo_s=intval($photo_s);if ($photo_s == 1)$ZEAI_SQL .= " AND U.photo_s<>'' AND U.photo_f=1 ";
			$areaid=trimhtml(dataIO($areaid,'out'));
			$area2id=trimhtml(dataIO($area2id,'out'));
			$areaid=getareaSQL($areaid);
			$area2id=getareaSQL($area2id);
			if(!empty($areaid))$ZEAI_SQL .= " AND U.areaid LIKE '%".$areaid."%' ";
			if(!empty($area2id))$ZEAI_SQL .= " AND U.area2id LIKE '%".$area2id."%' ";
			//age
			$age=trimhtml(dataIO($age,'out'));
			if(!empty($age)){
				$V=explode(',',$age);
				$V1=intval($V[0]);$V2=intval($V[1]);
				if(ifint($V1))$ZEAI_SQL .= " AND ( (YEAR(CURDATE())-YEAR(U.birthday)-(RIGHT(CURDATE(),5)<RIGHT(U.birthday,5))) >= '$V1' ) ";
				if(ifint($V2))$ZEAI_SQL .= " AND ( (YEAR(CURDATE())-YEAR(U.birthday)-(RIGHT(CURDATE(),5)<RIGHT(U.birthday,5))) <= '$V2' ) ";
			}
			//heigh
			$heigh=trimhtml(dataIO($heigh,'out'));
			if(!empty($heigh)){
				$V=explode(',',$heigh);$V1=intval($V[0]);$V2=intval($V[1]);
				if (ifint($V1))$ZEAI_SQL .= " AND ( U.heigh >= '$V1' ) ";
				if (ifint($V2))$ZEAI_SQL .= " AND ( U.heigh <= '$V2' ) ";
			}
			//weigh
			$weigh=trimhtml(dataIO($weigh,'out'));
			if(!empty($weigh)){
				$V=explode(',',$weigh);$V1=intval($V[0]);$V2=intval($V[1]);
				if (ifint($V1))$ZEAI_SQL .= " AND ( U.weigh >= '$V1' ) ";
				if (ifint($V2))$ZEAI_SQL .= " AND ( U.weigh <= '$V2' ) ";
			}
			//edu
			$edu=intval($edu);if(!empty($edu))$ZEAI_SQL .= " AND ( U.edu >= '$edu' ) ";
			//pay
			$pay=intval($pay);if(!empty($pay))$ZEAI_SQL .= " AND ( U.pay >= '$pay' ) ";
			//job
			$job=trimhtml(dataIO($job,'out'));if(!empty($job))$ZEAI_SQL .= doinsql('U.job',$job);
			//love
			$love=trimhtml(dataIO($love,'out'));if(!empty($love))$ZEAI_SQL .= doinsql('U.love',$love);
			//child
			$child=trimhtml(dataIO($child,'out'));if(!empty($child))$ZEAI_SQL .= doinsql('U.child',$child);
			//house
			$house=trimhtml(dataIO($house,'out'));if(!empty($house))$ZEAI_SQL .= doinsql('U.house',$house);
			//car
			$car=trimhtml(dataIO($car,'out'));if(!empty($car))$ZEAI_SQL .= doinsql('U.car',$car);
			//marrytime
			$marrytime=trimhtml(dataIO($marrytime,'out'));if(ifint($marrytime))$ZEAI_SQL .= " AND U.marrytime='$marrytime' ";
			$par = "&sex=".$sex."&photo_s=".$photo_s."&areaid=".$areaid."&area2id=".$area2id."&age=".$age."&heigh=".$heigh."&weigh=".$weigh."&edu=".$edu."&pay=".$pay."&job=".$job."&love=".$love."&child=".$child."&house=".$house."&car=".$car."&marrytime=".$marrytime;
		}
		$QZSQL = $ZEAI_SQL;
	break;
}
$ZEAI_SQL .=" AND a.qid=".$qid." AND a.uid=U.id";
if(ifint($uid))$ZEAI_SQL .= " AND a.uid<>$uid ";
$ZEAI_SELECT="SELECT a.uid,U.sex,U.grade,U.nickname,U.photo_s,U.photo_f,U.areatitle,U.job,U.birthday,U.heigh,U.edu,U.flag AS uflag,U.photo_ifshow FROM ".__TBL_QUN_U__." a,".__TBL_USER__." U WHERE 1=1 ".$ZEAI_SQL." ORDER BY a.id DESC";
if($submitok=='ZEAI_list'){exit(Zeai_ajax_list_fn($ZEAI_totalP,$p));}
$rtt=$db->query("SELECT COUNT(*) FROM ".__TBL_QUN_U__." a,".__TBL_USER__." U WHERE 1=1 ".$ZEAI_SQL);
$roww = $db->fetch_array($rtt,'num');
$ZEAI_total = $roww[0];
$ZEAI_totalP= ceil($ZEAI_total/$_ZEAI['pagesize']);
$cs = "qid=".$qid."&t=".$t."&keyword=".$keyword.$par;
?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo $title;?>群成员列表 - <?php echo $_ZEAI['siteName'];?></title>
<?php echo HEADMETA;?>
<meta name="generator" content="Zeai.cn qun1.0" />
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo RES;?>m/css/qun.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo HOST;?>/cache/areadata.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/zeai_div_area.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo HOST;?>/cache/udata.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script>var qun_ulist=true;</script>
<script src="<?php echo RES;?>m/js/qun.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>zeai_ios_select/separate/select.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<style>
.hx_top:after{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
#backtop a{background-color:#fff;color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.ulist dl dd h5 b:first-child{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.5)}
.ulist dl .enter{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.08);color:<?php echo $_ZEAI['mob_mbcolor'];?>;border-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.2)}
.ulist_search{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>;box-shadow:0 3px 8px rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.4)}
/*div_left_so*/
.div_left_so a.ed,
.div_left_so a.ed:after{color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.div_left_so ul.def li.ed{color:<?php echo $_ZEAI['mob_mbcolor'];?>;background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.1)}
.div_left_so .listbox dl dd span.ed{color:<?php echo $_ZEAI['mob_mbcolor'];?>;border-top-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.div_left_so_areabox .ul dt.ed{color:<?php echo $_ZEAI['mob_mbcolor'];?>;border-top-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.div_left_so_areabox .ul li a.ed{color:<?php echo $_ZEAI['mob_mbcolor'];?>;background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.1)}
.areabox .ul li a.ed{color:<?php echo $_ZEAI['mob_mbcolor'];?>;background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.1)}
.areabox .ul dt.ed,.listbox dl dd span.ed{color:<?php echo $_ZEAI['mob_mbcolor'];?>;border-top-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.ios-select-widget-box header.iosselect-header a.sure{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>;}
<?php
if ($_ZEAI['m_mb']==2){
	echo '.TRnav_btn i{color:'.$_ZEAI['mob_mbcolor'].'}';
	$mini_class='top_mini4';
}else{
	$mini_class='top_mini4 zeaibg bgcolor yunbox';
}
?>
</style>
</head><body>
<?php 
$mini_title='群成员';
$mini_L = '<em onClick="zeai.openurl(\''.mHref('qun',$qid).'\')"><i class="ico" >&#xeaca;</i></em>';
require_once ZEAI.'m/top_mini.php';
?>
<div class="ulist" id="ZEAI_list"><?php 
if(ifint($uid)){
	$row = $db->ROW(__TBL_USER__." U"," id AS uid,sex,grade,nickname,photo_s,photo_f,areatitle,job,birthday,heigh,edu,flag AS uflag,photo_ifshow","id=".$uid.$QZSQL,"name");
	if ($row){echo rows_ulist($row,1);$nodatatips='';}
}
if($ZEAI_totalP>0){echo Zeai_ajax_list_fn($ZEAI_totalP,$p);}else{echo $nodatatips;}?></div>
<?php if ($ZEAI_total > $_ZEAI['pagesize']){?>
<script>
var scs='<?php echo trimhtml($cs); ?>';
var ZEAI_totalP = parseInt(<?php echo $ZEAI_totalP; ?>);
var postjson = {submitok:'ZEAI_list',ZEAI_totalP:ZEAI_totalP};
if(!zeai.empty(scs))Object.assign(postjson,tojson(scs.split('&')));
zeaiOnscroll_json={url:'qun_ulist'+zeai.extname,data:postjson};
</script>
<script src="<?php echo RES;?>m/js/zeai_loading_data.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<div id="backtop"><a href="#top" id="btmTopBtn"><i class="ico">&#xe60c;</i>顶部</a></div>
<div class="blankbottom">没有更多了</div>
<?php }?>
<a class="ulist_search" id="ulist_search"><i class="ico">&#xe66c;</i> 筛选</a>
<!--div_left_so-->
<div id="rangebox"></div>
<div class="div_left_so" id="ulist_so">
	<form action="qun_ulist.php" method="get" name="www.yzlove.com" id="ZEAI_CN_FORM_ext"><br>
    	<div class="form_uid">
        <input name="keyword" type="text" class="input" id="keyword" maxlength="20" value="<?php echo $keyword;?>" placeholder="按成员UID/昵称" autocomplete="off">
        <button type="submit" class="ico">&#xe6c4;</button>
		</div>
        <?php
		div_left_so_out(array('tbody'=>$FT['sex']['t'],'t'=>'sex','tv'=>$sex,'subkind'=>3,'newarr'=>json_decode($_UDATA['sex']),'ulcls'=>' col3'));//性别
        div_left_so_out(array('tbody'=>$FT['photo_s']['t'],'t'=>'photo_s','tv'=>$photo_s,'subkind'=>2,'newarr'=>json_decode('[{"i":"1","v":"有头像"}]'),'ulcls'=>' col3'));//头像
		//默认值
		function range_str($F,$V) {
			if(empty($V))return '';
			global $_UDATA;
			$FARR=explode(',',$V);
			$F1=$FARR[0];$F2=$FARR[1];
			$F_UDATA=json_decode($_UDATA[$V],true);
			$F_str = mateset_out($F1,$F2,$F_UDATA['dw']);
			$F_str = str_replace("不限","",$F_str);
			return $F_str;
		}		
        ?>
        <div class="listbox"><dl id="age" data="<?php echo (empty($age))?'23,24':$age;?>" class="rang"><dt>年龄范围</dt><dd><span><?php echo range_str('age',$age);?></span></dd></dl></div>
        <input type="hidden" id="form_age" name="age" value="<?php echo $age;?>">
        <div class="listbox"><dl id="heigh" data="<?php echo (empty($heigh))?'160,175':$heigh;?>" class="rang"><dt>身高范围</dt><dd><span><?php echo range_str('heigh',$heigh);?></span></dd></dl></div>
        <input type="hidden" id="form_heigh" name="heigh" value="<?php echo $heigh;?>">
        <div class="listbox"><dl id="weigh" data="<?php echo (empty($weigh))?'50,70':$weigh;?>" class="rang"><dt>体重范围</dt><dd><span><?php echo range_str('weigh',$weigh);?></span></dd></dl></div>
        <input type="hidden" id="form_weigh" name="weigh" value="<?php echo $weigh;?>">
        <!--地区-->
        <!--gz-->
        <div id="areabox" class="areabox"><div class="ul"><li><dl><dd></dd></dl></li></div></div>
        <input type="hidden" id="form_areaid" name="areaid" value="<?php echo $areaid;?>">
        <input type="hidden" id="form_areatitle" name="areatitle" value="<?php echo trimhtml($areatitle);?>">
        <div class="listbox">
            <dl id="areaid" data="<?php echo $areaid;?>"><dt>工作地</dt><dd><span id="areatitle"><?php echo trimhtml($areatitle);?></span></dd></dl>
        </div>
        <!--hj-->
        <div id="areabox2" class="areabox"><div class="ul"><li><dl><dd></dd></dl></li></div></div>
        <input type="hidden" id="form_area2id" name="area2id" value="<?php echo $area2id;?>">
        <input type="hidden" id="form_area2title" name="area2title" value="<?php echo trimhtml($area2title);?>">
        <div class="listbox">
            <dl id="area2id" data="<?php echo $area2id;?>"><dt>户籍地</dt><dd><span id="area2title"><?php echo trimhtml($area2title);?></span></dd></dl>
        </div>
        <input type="hidden" name="t" id="t" value="ext">
        <input type="hidden" name="qid" id="qid" value="<?php echo $qid;?>">
        <!--地区结束-->
        <?php
        div_left_so_out(array('tbody'=>$FT['love']['t'],'t'=>'love','tv'=>$love,'subkind'=>3,'newarr'=>json_decode($_UDATA['love']),'ulcls'=>' col3','show'=>'off'));//婚况
        div_left_so_out(array('tbody'=>$FT['child']['t'],'t'=>'child','tv'=>$child,'subkind'=>3,'newarr'=>json_decode($_UDATA['child']),'ulcls'=>' col3','show'=>'off'));//小孩
        div_left_so_out(array('tbody'=>'最低'.$FT['edu']['t'],'t'=>'edu','tv'=>$edu,'subkind'=>2,'newarr'=>json_decode($_UDATA['edu']),'ulcls'=>' col3','show'=>'off'));//学历
        div_left_so_out(array('tbody'=>'最低'.$FT['pay']['t'],'t'=>'pay','tv'=>$pay,'subkind'=>2,'newarr'=>json_decode($_UDATA['pay']),'ulcls'=>' col3','show'=>'off'));//收入
        div_left_so_out(array('tbody'=>$FT['job']['t'],'t'=>'job','tv'=>$job,'subkind'=>3,'newarr'=>json_decode($_UDATA['job']),'ulcls'=>' col3','show'=>'off'));//职业
        div_left_so_out(array('tbody'=>$FT['house']['t'],'t'=>'house','tv'=>$house,'subkind'=>3,'newarr'=>json_decode($_UDATA['house']),'ulcls'=>' col2','show'=>'off'));//房
        div_left_so_out(array('tbody'=>$FT['car']['t'],'t'=>'car','tv'=>$car,'subkind'=>3,'newarr'=>json_decode($_UDATA['car']),'ulcls'=>' col2','show'=>'off'));//车
        div_left_so_out(array('tbody'=>$FT['marrytime']['t'],'t'=>'marrytime','tv'=>$marrytime,'subkind'=>2,'newarr'=>json_decode($_UDATA['marrytime']),'ulcls'=>' col3','show'=>'off'));//结婚时间	
        ?>
        <script>
		div_left_so_init('ulist_so')
		var age_ARR1 = age_ARR,
		age_ARR2 = age_ARR,
		heigh_ARR1 = heigh_ARR,
		heigh_ARR2 = heigh_ARR,
		weigh_ARR1 = weigh_ARR,
		weigh_ARR2 = weigh_ARR;
		o('areaid').onclick=areaidFn
		o('area2id').onclick=area2idFn
		ZeaiM.divMod({kind:'range',obj:age,end:function(e,i){o('form_age').value=e;}});
		ZeaiM.divMod({kind:'range',obj:heigh,end:function(e,i){o('form_heigh').value=e;}});
		ZeaiM.divMod({kind:'range',obj:weigh,end:function(e,i){o('form_weigh').value=e;}});
		processHash();
        </script>
        <div class="savebox"><button type="button" class="btn size3 reset" onClick="div_left_so_reset('ulist_so',['t','qid'])">重置</button><button type="submit" class="btn size3 zeaibg ico">&#xe6c4; 确定</button></div>
    </form>
</div>
<!--div_left_so end-->

<?php if (is_weixin() && ifint($cook_uid)){wx_endurl('您刚刚浏览的页面【单身群成员列表】',$jumpurl);}?>
<div id="backtop"><a href="#top" id="btmTopBtn"><i class="ico">&#xe60c;</i>顶部</a></div>
<script>ulist_search.onclick=ulist_soFn;</script>
<?php //require_once ZEAI.'m/TRnav.php';?>
</body></html>
<?php ob_end_flush();?>